home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
User's Choice Windows CD
/
User's Choice Windows CD (CMS Software)(1993).iso
/
win_q_t
/
trem.zip
/
SIZE.C
< prev
next >
Wrap
Text File
|
1991-05-11
|
3KB
|
81 lines
/************************************************************************
*
* Copyright (c) 1991 Microsoft Corporation. All Rights Reserved.
*
*-----------------------------------------------------------------------
*
* Project: Windows Terminal Example
*
* Module: size.c
*
* Author: Bryan A. Woodruff (baw)
*
*
* Remarks: Handles the sizing of the terminal window
*
* Revisions:
* 01.00.000 5/ 8/91 baw Wrote it
*
************************************************************************/
#include "terminal.h"
/************************************************************************
* BOOL SizeTerminal( HWND hWnd, WORD wVertSize, WORD wHorzSize )
*
* Description:
* Sizes terminal and sets up scrolling regions
*
* Comments:
* 5/ 8/ 91 baw Wrote it
*
************************************************************************/
BOOL SizeTerminal( HWND hWnd, WORD wVertSize, WORD wHorzSize )
{
int nScrollAmt ;
LOCALHANDLE hTermInfo ;
NPTERMINFO npTermInfo ;
hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
return ( FALSE ) ;
if (npTermInfo -> ySize != (int) wVertSize)
{
npTermInfo -> ySize = (int) wVertSize ;
npTermInfo -> yScroll = max( 0, (MAXROWS * npTermInfo -> yChar) -
npTermInfo -> ySize ) ;
nScrollAmt = min( npTermInfo -> yScroll, npTermInfo -> yOffset ) -
npTermInfo -> yOffset ;
ScrollWindow( hWnd, 0, -nScrollAmt, NULL, NULL ) ;
npTermInfo -> yOffset = npTermInfo -> yOffset + nScrollAmt ;
SetScrollPos( hWnd, SB_VERT, npTermInfo -> yOffset, FALSE ) ;
SetScrollRange( hWnd, SB_VERT, 0, npTermInfo -> yScroll, TRUE ) ;
InvalidateRect( hWnd, NULL, TRUE ) ;
}
if (npTermInfo -> xSize != (int) wHorzSize)
{
npTermInfo -> xSize = (int) wHorzSize ;
npTermInfo -> xScroll = max( 0, (MAXCOLS * npTermInfo -> xChar) -
npTermInfo -> xSize ) ;
nScrollAmt = min( npTermInfo -> xScroll, npTermInfo -> xOffset) -
npTermInfo -> xOffset ;
ScrollWindow( hWnd, 0, -nScrollAmt, NULL, NULL ) ;
npTermInfo -> xOffset = npTermInfo -> xOffset + nScrollAmt ;
SetScrollPos( hWnd, SB_HORZ, npTermInfo -> xOffset, FALSE ) ;
SetScrollRange( hWnd, SB_HORZ, 0, npTermInfo -> xScroll, TRUE ) ;
InvalidateRect( hWnd, NULL, TRUE ) ;
}
LocalUnlock( hTermInfo ) ;
return ( TRUE ) ;
} /* end of SizeTerminal() */
/************************************************************************
* End of File: size.c
************************************************************************/